var mysql = require("mysql");
var connection = mysql.createConnection({
  host: "localhost",
  user: "root",
  password: "m*123456",
  database: "project",
});

connection.connect();

// DELETE FROM node_user WHERE id = 7
// UPDATE node_user SET name = ?,age = ? WHERE id = ?
// INSERT INTO node_user(id,name,age) VALUES(0,?,?)

// connection.query(
//   "DELETE FROM product WHERE id = 2",
//   function (error, results, fields) {
//     if (error) throw error;
//   }
// );

// connection.query(
//   "INSERT INTO product(id,name,price,description) VALUES(0,?,?,?)",
//   ["商品3", "10.00", "这是描述"],
//   function (error, results, fields) {
//     if (error) throw error;
//   }
// );

// connection.query(
//   "INSERT INTO admin(account,password,token) VALUES(?,?,?)",
//   ["13588421272", "admin", "token"],
//   function (error, results, fields) {
//     if (error) throw error;
//     for (let i = 0; i < results.length; i++) {
//       let element = results[i];
//       console.log("account == ", element.account);
//       console.log("password == ", element.password);
//     }
//   }
// );

// connection.query(
//   "UPDATE admin SET token = ? where account = 15157121662",
//   ["12312djksahdadkjsahd"],
//   function (error, results, fields) {
//     if (error) throw error;
//     for (let i = 0; i < results.length; i++) {
//       let element = results[i];
//       console.log("account == ", element.account);
//       console.log("password == ", element.password);
//     }
//   }
// );

// connection.query(
//   "SELECT * FROM admin where account = 15157121662",
//   function (error, results, fields) {
//     if (error) throw error;
//     for (let i = 0; i < results.length; i++) {
//       let element = results[i];
//       console.log("account == ", element.account);
//       console.log("password == ", element.password);
//     }
//   }
// );
